#include "centerwidget.h"
#include <QDebug>

CenterWidget::CenterWidget(QWidget *parent) : QOpenGLWidget(parent)
{

}

void CenterWidget::initializeGL()
{
    qDebug()<<"initializeGL";
    float vertices2[] = {
         // second triangle
         0.0f, -0.5f, 0.0f,  // left
         0.9f, -0.5f, 0.0f,  // right
         0.45f, 1.0f, 0.0f   // top
    };


    core = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_3_Core>();

}

void CenterWidget::paintGL()
{
    core->glClearColor(0.6f, 0.8f,0.6f, 1.0f);
    core->glClear(GL_COLOR_BUFFER_BIT);

    float vertices[] = {
        // first triangle
               -0.9f, -0.5f, 0.0f,  // left
               -0.0f, -0.5f, 0.0f,  // right
               -0.45f, 0.5f, 0.0f,  // top
    };
    //core->glDrawElementsBaseVertex()
    update();
}

void CenterWidget::resizeGL(int w, int h)
{
    qDebug() <<"w : "<< w<< "h : "<<h;
}
